<template>
  <view class="container">
    <view class="none_net">
      <text class="net_text">当前无网络连接</text>
      <u-button @click="reload" class="net_reset" type="primary"
                color="rgb(240, 169, 160)"
                text="重新加载"></u-button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },

  methods: {

    //重新加载
    reload() {

      // uni.showToast({title: "已点击加载"})
      uni.showLoading({title: "加载中"})
      uni.getNetworkType({
        success: function (res) {
          uni.hideLoading();
          console.log(res.networkType);
          // uni.$u.toast(res.networkType)
          if (res.networkType === "none") {
            uni.redirectTo({
              url: '/pages/networknone/networknone'
            });
          } else {

            // uni.navigateTo({
            uni.switchTab ({
              url: '/pages/index/index'
            });
          }
        }

      });
    },
  }
}
</script>

<style lang="scss">
.container {
  position: absolute;
  display: flex;
  justify-content: center;
  flex-direction: row;
  align-items: center;
  height: 100%;
  width: 100%;

  .none_net {
    transform: translateY(-50%);

    .net_text {
      color: $sys-color-grey;
    }

    .net_reset {
      margin-top: $sys-margin-top-50;
    }
  }
}
</style>
